<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
	<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
	<script>
			$(document).on("pageinit","#loginpage",function(){
				$("#login").click(function(){
					$.ajax(
					{
						url:"http://192.168.1.107:8080/login",
						dataType: "json",
						data:{
							"simnote.userName":$("#userName").val(),
							"simnote.passWord":$("#password").val()
						},
						type:"POST",
						success: function(data, status){
							if(data.info=="sucess"){
								window.location.assign("http://192.168.1.107:8080/userInterface");
							}
                     },
						error:function(data,status){
							alert(data.info);
						}
					});
				});
				$("#register").click(function(){
					$.ajax(
					{
						url:"http://192.168.1.107:8080/register",
						dataType: "json",
						data:{
							"simnote.userName":$("#userName").val(),
							"simnote.passWord":$("#password").val(),
							"simnote.deviceType": 10000001
						},
						type:"POST",
						success: function(data, status){
							if(data.info=="sucess"){
								$("#loginsucess").click();
							}
                     },
						error:function(data,status){
							alert(data.info);
						}
					});
				});
			});
		</script>
	<title>登录界面</title>
</head>
<body>
<div data-role="page" id="loginpage">
	<div data-role="header">
		<a data-role="button" href="#" data-icon="home">主页</a>
		<h1>简易笔记本用户登录</h1>
		<a data-role="button" href="#" data-icon="search">搜索</a>
	</div>
	<div data-role="content">
		<div data-role="fieldContain">
			<label for="username">用户名</label>
			<input type="text" name="userName" id="userName"/>
			<label for="password">密码</label>
			<input type="text" name="password" id="password"/>
			<button name="login" id="login">登录</button>
			<button name="register" id="register">注册</button>
			<a id="loginsucess" style="visibility:hidden" href="#loginpopup" data-rel="popup" data-transition="fade" data-position-to="window">注册成功</a>
			<div id="loginpopup" data-role="popup" data-overlay-theme="f">恭喜你注册成功</div>
		</div>
	</div>
</div>
</body>
</html>